<%@page import="java.util.HashMap"%>
<%@page import="qingke.mybatis.pojo.OrderDetail"%>
<%@page import="java.util.List"%>
<%@page import="qingke.mybatis.pojo.Order"%>
<%@page import="java.util.Map"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="${pageContext.request.contextPath }/css/personalcenter.css"
	type="text/css" rel="stylesheet" />
<link href="${pageContext.request.contextPath }/css/bootstrap.min.css"
	type="text/css" rel="stylesheet" />
<script src="${pageContext.request.contextPath }/js/jquery-1.8.3.min.js"></script>
<script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath }/js/personal.js"></script>
</head>
<%
	Map<Order, List<OrderDetail>> orders = new HashMap<>();
	Object ordersObject = session.getAttribute("orders");
	if (ordersObject != null) {
		if (ordersObject instanceof Map) {
			orders = (Map<Order, List<OrderDetail>>) ordersObject;
		}
	}
%>
<body>
	<div class="person-content-location">
		<a href="" role="button">当前位置</a> > <a href="" role="button">个人中心</a>
		> <a href="" role="button">我的订单</a>
	</div>
	<hr />
	<div>
		<%
			for (Map.Entry<Order, List<OrderDetail>> entrys : orders.entrySet()) {
				Order order = (Order) entrys.getKey();
				List<OrderDetail> orderDetails = entrys.getValue();
		%>
		<div style="border: 1px solid blue;">
			<table class="table table-hover">
				<thead>
					<tr>
						<th>名字</th>
						<th>价格</th>
						<th>数量</th>
						<th>总价</th>
						<th>
							<%
								if (0 == order.getOrderStatusId()) {
							%> <a onclick="chenge(<%=order.getId()%>)" href="">取消订单</a> <%
 	}
 %>
						</th>
					</tr>
				</thead>
				<tbody>
					<%
						for (OrderDetail orderDetail : orderDetails) {
					%>
					<tr>
						<td><%=orderDetail.getProductName()%></td>
						<td><%=orderDetail.getProductPrice()%></td>
						<td><%=orderDetail.getProductNumber()%></td>
						<td><%=Double.valueOf(orderDetail.getProductNumber())
							* Double.valueOf(orderDetail.getProductPrice())%></span></td>
						<td></td>
					</tr>

					<%
						}
					%>
				</tbody>
				<tfoot>
					<tr>
						<th>我的订单:<%=order.getOrderCode()%></th>
						<th>订单状态：<%=order.showOrderStatus()%></th>
						<th>订单价格：<%=order.getTotals()%></th>
						<th colspan="2">下单时间：<%=order.showOrderTime()%></th>
					</tr>
				</tfoot>
			</table>

		</div>
		<div>
			<hr />
		</div>
		<%
			}
		%>
	</div>
</body>
</html>